from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from utils import Driver


class BasePage:
    def __init__(self):
        self.driver = Driver.get_login_driver()

    def get_element(self, location):
        wait = WebDriverWait(self.driver, 10, 1)
        element = wait.until(lambda x: x.find_element(*location))
        return element


class BaseHandler:
    def input_text(self, elem, text):
        elem.clear()
        elem.send_keys(text)

    def select(self, elem, visible):
        select_ = Select(elem)
        select_.select_by_visible_text(visible)